package com.cosmosource.core.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @author cosmo
 */
@Data
@Component
@ConfigurationProperties("cosmosource.datasource")
public class DataSourceProperties {

    private String type;

    private String version;

    private String url;

    private String driverClassName;

    private String username;

    private String password;

    private DataSourcePoolProperties pool;

    @Data
    public static class DataSourcePoolProperties {
        private boolean testWhileIdle;

        private String filters = "stat";

        private String initialSize = "1";

        private String minIdle = "1";

        private String maxActive = "20";

        private String maxWait = "60000";

        private String timeBetweenEvictionRunsMillis = "60000";

        private String minEvictableIdleTidspillis = "300000";

        private String validationQuery = "select 'x'";

        private String testOnBorrow = "false";

        private String testOnReturn = "false";

        private String poolPreparedStatements = "true";

        private String maxOpenPreparedStatements = "20";

        private String asyncInit = "true";
    }

}
